<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var day = 2
        switch (day) {
            case 1:
                console.log("今天星期一");
                break
            case 2: {
                console.log("今天星期二");
                break
            }
            case 3: {
                console.log("今天星期三");
                break
            }
            case 4: {
                console.log("今天星期四");
                break
            }
            case 5: {
                console.log("今天星期五");
                break
            }
            case 6: {
                console.log("今天星期六");
                break
            }
            default: {
                console.log("今天星期日");

            }
        }
        // 如果不加break 则会去继续执行接下来的case代码块；而不是跳出switch结构 如：
        var x = 3
        switch (x) {
            case 1:
                console.log("x为1");

            case 2:
                console.log("x为2");


            case 3:
                console.log("x为3");


            default:
                console.log("x未知");





        }

    </script>
</body>

</html>